package com.anjufang.mapper;

import com.anjufang.entity.GroupDetail;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * <p>
  * 分组详情 Mapper 接口
 * </p>
 *
 * @author wcy
 * @since 2021-11-04
 */
public interface GroupDetailMapper extends BaseMapper<GroupDetail> {

    List<GroupDetail> queryList(Map<String, Object> map);

    int queryTotal(Map<String, Object> map);

    @Select("SELECT * FROM group_detail WHERE is_deleted = 0 ORDER BY sort_num DESC LIMIT 1\n")
    GroupDetail getLast();

    @Update("UPDATE group_detail SET is_deleted = 1 WHERE is_deleted = 0")
    int deleteAll();

}